
package com.github.ybq.parallaxviewpager.Interpolator;

/**
 * Accelerate interpolator
 */
public class AccelerateInterpolator extends BaseInterpolator {
    /**
     * M factor
     */
    private final float mFactor;
    /**
     * M double factor
     */
    private final double mDoubleFactor;

    /**
     * Accelerate interpolator
     */
    public AccelerateInterpolator() {
        mFactor = 1.0f;
        mDoubleFactor = 2.0;
    }

    /**
     * Accelerate interpolator
     *
     * @param factor factor
     */
    public AccelerateInterpolator(float factor) {
        mFactor = factor;
        mDoubleFactor = 2 * mFactor;
    }


    /**
     * Get interpolation float
     *
     * @param input input
     * @return the float
     */
    public float getInterpolation(float input) {
        if (mFactor == 1.0f) {
            return input * input;
        } else {
            return (float) Math.pow(input, mDoubleFactor);
        }
    }

}
